<template>
  <tabbar style="position: fixed;" class="pouing" >
    <tabbar-item link="/PositionPage" v-if="parseInt(identity) === 1" :selected="selected.indexOf('PositionPage') !== -1">
     <img slot="icon-active" src="./images/buto1.png" alt="">
     <img slot="icon" src="./images/butoc1.png" alt="">
      <span slot="label" class="cloroe">职位</span>
    </tabbar-item>
    <tabbar-item  link="/talents" v-if="parseInt(identity) === 2" :selected="selected.indexOf('talents') !== -1">
     <img slot="icon-active" src="./images/buto1.png" alt="">
     <img slot="icon" src="./images/butoc1.png" alt="">
      <span slot="label" class="cloroe">人才</span>
    </tabbar-item>
    <tabbar-item link="/talentPage" v-if="parseInt(identity) === 1" :selected="selected.indexOf('talentPage') !== -1">
      <img slot="icon-active" src="./images/buto2.png" alt="">
      <img slot="icon" src="./images/butoc2.png" alt="">
      <span slot="label" class="cloroe">公司</span>
    </tabbar-item>
    <tabbar-item  link="/newsPage?category=3" :selected="selected.indexOf('newsPage') !== -1">
      <img slot="icon-active" src="./images/buto3.png" alt="">
      <img slot="icon" src="./images/butoc3.png" alt="">
      <span slot="label" class="cloroe">资讯</span>
    </tabbar-item>
    <tabbar-item link="/myPage" :selected="selected.indexOf('myPage') !== -1">
      <img slot="icon-active" src="./images/buto4.png" alt="">
      <img slot="icon" src="./images/butoc4.png" alt="">
      <span slot="label" class="cloroe">我的</span>
    </tabbar-item>
  </tabbar>
</template>
<script>
import { TabbarItem, Tabbar } from 'vux'

export default {
  components: {
    Tabbar,
    TabbarItem
  },
  data () {
    return {
      comseo: '',
      identity: 1
    }
  },
  props: {
    selected: {
      type: String,
      default: 'PositionPage'
    }
  },
  mounted () {
    this._getuser()
    this.identity = localStorage.getItem('identity') ? localStorage.getItem('identity') : 1
    console.log(this.identity)
  },
  computed: {
    cartCount () {
      return this.$store.getters.cartCount + ''
    }
  },
  methods: {
    _getuser () {
      this.$http.post('/entrance').then(response => {
        this.comseo = response.data.data
        localStorage.setItem('identity', this.comseo.identity)
      }).catch(error => {
        console.log(error)
      })
    }
  }
}
</script>
<style>
 .pouing .weui-tabbar__item.weui-bar__item_on .cloroe {
    color: #32B6C6 !important;
  }
.pouing .weui-tabbar__label {
    text-align: center;
    color: #313131!important;
    font-size: 10px;
    line-height: 1.8;
}
</style>

